/*
 * Copyright 2012-2014 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.jqd.framework.core.spring;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;

/**
 * <p>
 * 对于spring注解注册bean时默认的beanName为简单类名的第一个字母小写（如:com.service.FooSerice类
 * 在spring容器中注册之后的beanName为'fooService'），spring框架默认实现代码参考
 * {@link AnnotationBeanNameGenerator#buildDefaultBeanName(BeanDefinition)}，
 * 在某些情况下可能存在一个项目中不同包下面存在同名的类，这样如果都采用默认beanName策略就会导致spring容器注册bean失败
 * </p>
 * 
 * <p>
 * 该类通过重写spring容器生成beanName的默认策略，重写之后采用类的全名（包括包名称）作为beanName，这样可以避免
 * 类名重复导致的bean注册失败，但需要在spring配置文件中配置该类，如下: <code>
 * 	<context:component-scan base-package="com.jqd.framework" name-generator="com.jqd.framework.core.context.ClassFullNameGenerator" />
 * </code>
 * </p>
 * TODO
 * 
 * @author liaozhicheng.cn@gmail.com
 * @date 2012-6-11
 * @since 1.0
 */
public class ClassFullNameGenerator extends AnnotationBeanNameGenerator {
	
	@Override
	protected String buildDefaultBeanName(BeanDefinition definition) {
		return definition.getBeanClassName();
	}
	
}
